<%@ page language="java" pageEncoding="UTF-8" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<HTML>
<HEAD>
    <meta http-equiv="Content-Language" content="zh-cn">
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <link href="${pageContext.request.contextPath}/admin/css/Style.css" rel="stylesheet" type="text/css"/>
    <script src="https://cdn.staticfile.org/jquery/2.1.1/jquery.min.js"></script>
    <link href="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
    <script src="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/js/bootstrap.min.js"></script>
<%--    <script language="javascript" src="${pageContext.request.contextPath}/admin/js/public.js"></script>--%>
    <script type="text/javascript">
        //添加商品
        function addProduct() {
            window.location.href = "${pageContext.request.contextPath}/admin/products/add.jsp";
        }

        //删除商品
        function p_del() {
            var msg = "您确定要删除该商品吗？";
            if (confirm(msg) == true) {
                return true;
            } else {
                return false;
            }
        }
    </script>
</HEAD>
<body>
<form id="Form1" name="Form1"
      action="${pageContext.request.contextPath}/findProductByManyCondition"
      method="post">
    <table cellSpacing="1" cellPadding="0" width="100%" align="center" border="0" style="font-size: 16px">
        <TBODY>
        <tr>
            <td class="ta_01" align="center" bgcolor="#afd1f3" style="padding-top: 15px; padding-bottom: 15px">
                <strong style="font-size: 22px">查 询 条 件</strong>
            </td>
        </tr>
        <tr>
            <td>
                <table cellpadding="0" cellspacing="0" border="0" width="100%">
                    <tr>
                        <td height="22" align="center" class="ta_01">商品编号</td>
                        <td class="ta_01">
                            <input type="text" class="form-control" style="width: 200px" name="id" size="15" value=""
                                   id="Form1_userName" class="bg"/>
                        </td>
                        <td height="22" align="center" class="ta_01">类别：</td>
                        <td class="ta_01">
                            <select name="category" id="category" style="height:40px;background:#fff;
color: #a1a1a1; font-size: 16px;
border:1px solid #E4E4E4;cursor:pointer;position:relative;_filter:alpha(opacity=0);
">
                                <option value="" selected="selected">--选择商品类别--</option>
                                <option value="文学">文学</option>
                                <option value="生活">生活</option>
                                <option value="计算机">计算机</option>
                                <option value="外语">外语</option>
                                <option value="经营">经营</option>
                                <option value="励志">励志</option>
                                <option value="社科">社科</option>
                                <option value="学术">学术</option>
                                <option value="少儿">少儿</option>
                                <option value="艺术">艺术</option>
                                <option value="原版">原版</option>
                                <option value="科技">科技</option>
                                <option value="考试">考试</option>
                                <option value="生活百科">生活百科</option>
                            </select>
                        </td>
                    </tr>
                    <tr>
                        <td height="22" align="center" class="ta_01">商品名称：</td>
                        <td class="ta_01">
                            <input class="form-control" style="width: 200px" type="text" name="name" size="15" value=""
                                   id="Form1_userName" class="bg"/>
                        </td>
                        <td height="22" align="center" class="ta_01">价格区间(元)：</td>
                        <td class="ta_01">
                            <input class="form-control" style="width: 200px" type="text" name="minprice" size="10"
                                   value=""/>
                            -
                            <input class="form-control" style="width: 200px" type="text" name="maxprice" size="10"
                                   value=""/>
                        </td>
                    </tr>
                    <tr>
                        <td width="100" height="22" align="center" class="ta_01"></td>
                        <td class="ta_01">
                            <font face="宋体" color="red"> &nbsp;</font>
                        </td>
                        <td align="right" class="ta_01">
                            <br/><br/>
                        </td>
                        <td align="right" class="ta_01">
                            <button type="submit" id="search" name="search" value="&#26597;&#35810;"
                                    class="btn btn-primary">
                                &#26597;&#35810;
                            </button>
                            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                            <input type="reset" name="reset" value="&#37325;&#32622;" class="btn btn-danger"/>
                            <button type="button" id="add" name="add" value="&#28155;&#21152;" class="btn btn-default"
                                    onclick="addProduct()">
                                &#28155;&#21152;
                            </button>
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
        <tr>
            <td class="ta_01" align="center" bgcolor="#afd1f3" style="padding-top: 15px; padding-bottom: 15px"><strong
                    style="font-size: 22px">商 品 列 表</strong>
            </TD>
        </tr>
<%--        <tr>--%>
<%--            <td class="ta_01" align="right">--%>

<%--            </td>--%>
<%--        </tr>--%>
        <tr>
            <td class="ta_01" align="center" style="font-size: 18px">
                <table cellspacing="0" cellpadding="1" rules="all"
                       bordercolor="gray" border="1" id="DataGrid1"
                       class="table table-hover table-striped" style="font-size: 18px"
                <%--style="BORDER-RIGHT: gray 1px solid; BORDER-TOP: gray 1px solid; BORDER-LEFT: gray 1px solid; WIDTH: 100%; WORD-BREAK: break-all; BORDER-BOTTOM: gray 1px solid; BORDER-COLLAPSE: collapse; BACKGROUND-COLOR: #f5fafe; WORD-WRAP: break-word"--%>>
                    <tr <%--style="FONT-WEIGHT: bold; FONT-SIZE: 12pt; HEIGHT: 25px; BACKGROUND-COLOR: #afd1f3"--%>>
                        <td style="font-size: 18px" align="center" width="24%">商品编号</td>
                        <td style="font-size: 18px" align="center" width="18%">商品名称</td>
                        <td style="font-size: 18px" align="center" width="9%">商品价格</td>
                        <td style="font-size: 18px" align="center" width="9%">商品数量</td>
                        <td style="font-size: 18px" width="8%" align="center">商品类别</td>
                        <td style="font-size: 18px" width="8%" align="center">编辑</td>
                        <td style="font-size: 18px" width="8%" align="center">删除</td>
                    </tr>
                    <!--  循环输出所有商品 -->
                    <c:forEach items="${ps}" var="p">
                        <tr>
                            <td style="CURSOR: hand; HEIGHT: 22px;font-size: 16px" style="" align="center" width="200">${p.id }</td>
                            <td style="CURSOR: hand; HEIGHT: 22px;font-size: 16px" align="center" width="18%" style="font-size: 18px">${p.name }</td>
                            <td style="CURSOR: hand; HEIGHT: 22px;font-size: 16px" align="center" width="8%" style="font-size: 18px">${p.price }</td>
                            <td style="CURSOR: hand; HEIGHT: 22px;font-size: 16px" align="center" width="8%" style="font-size: 18px">${p.pnum }</td>
                            <td style="CURSOR: hand; HEIGHT: 22px;font-size: 16px" align="center" style="font-size: 18px">${p.category}</td>
                            <td align="center" style="HEIGHT: 22px" width="7%" style="font-size: 16px">
                                <a href="${pageContext.request.contextPath}/findProductById?id=${p.id}&type=admin" class="btn btn-primary" style="color: white">
<%--                                    <img src="${pageContext.request.contextPath}/admin/images/i_edit.gif" border="0"--%>
<%--                                         style="CURSOR: hand">--%>
                                    编辑
                                </a>
                            </td>
                            <td align="center" style="HEIGHT: 22px;font-size: 16px" width="7%" style="font-size: 16px">
                                <a href="${pageContext.request.contextPath}/deleteProduct?id=${p.id}"
                                   onclick="javascript:return p_del()" class="btn btn-danger" style="color: white">
<%--                                    <img src="${pageContext.request.contextPath}/admin/images/i_del.gif"--%>
<%--                                         width="16" height="16" border="0" style="CURSOR: hand">--%>
                                    删除
                                </a>
                            </td>
                        </tr>
                    </c:forEach>
                </table>
            </td>
        </tr>
        </TBODY>
    </table>
</form>
</body>
</HTML>